home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2008 February / PCWFEB08.iso / Software / Resources / Developers / PSPad 4.5.2 / pspad452inst_en.exe / {app} / PSPad.chm / js / controltree.js < prev   
Encoding:
Text File  |  2006-10-18  |  2.3 KB  |  76 lines

  1. function preloadimgs()
  2. {
  3.     var imgcount = 1;
  4.     document.imageArray = new Array(typeList.type.length * 4);
  5.     for(var i = 0; i < typeList.type.length; i++) {
  6.         preloadimg(imgcount++, typeList.type[i].pImg);
  7.         preloadimg(imgcount++, typeList.type[i].mImg);
  8.         preloadimg(imgcount++, typeList.type[i].bpImg);
  9.         preloadimg(imgcount++, typeList.type[i].bmImg);
  10.     }
  11. }
  12. function preloadimg(imgcount, imgsrc)
  13. {
  14.     document.imageArray[imgcount] = new Image;
  15.     document.imageArray[imgcount].src = imgsrc;
  16. }
  17. function spantoggle(node_info, state)
  18. {
  19.     var node_id = node_info;
  20.     node_info = node_info.split("-");
  21.     node_img = node_info[0];
  22.     var this_type = typeList.type[node_info[1]];
  23.     var theSpan = document.getElementById ? document.getElementById(node_id) : document.all ? document.all[node_id] : (new Object());
  24.     if(!theSpan) {
  25.         return;
  26.     }
  27.     if(theSpan.style) {
  28.         theSpan = theSpan.style;
  29.     }
  30.     if (theSpan.display == 'none') {
  31.         var collapse = false;
  32.     } else {
  33.         var collapse = true;
  34.     }
  35.     if (state != null) {
  36.         collapse = state;
  37.     }
  38.     if (collapse == false) {
  39.         theSpan.display = 'inline';
  40.         document.images[node_img + '_icon'].src = this_type.mImg;
  41.         document.images[node_img + '_branch'].src = this_type.bmImg;
  42.     } else {
  43.         theSpan.display = 'none';
  44.         document.images[node_img + '_icon'].src = this_type.pImg;
  45.         document.images[node_img + '_branch'].src = this_type.bpImg;
  46.     }
  47. }
  48. function spantoggleall(value)
  49. {
  50.     var oSpan = document.getElementsByTagName('span');
  51.     var node_id = '';
  52.     var this_type = '';
  53.     for (var i = 0; i < oSpan.length; i++) {
  54.         node_info = oSpan[i].id.split("-");
  55.         if (node_info[1] != null) spantoggle(oSpan[i].id, value);
  56.     }
  57. }
  58. function toggleclass(classname, value)
  59. {
  60.     var oSpan = document.getElementsByTagName('span');
  61.     for (var i = 0; i < oSpan.length; i++) {
  62.         if (oSpan[i].className == classname) {
  63.             spantoggle(oSpan[i].id, value);
  64.         }
  65.     }
  66. }
  67. function typeList() {this.type = [];}
  68. function type()
  69. {
  70.     this.pImg  = arguments[0];
  71.     this.mImg  = arguments[1];
  72.     this.bpImg = arguments[2];
  73.     this.bmImg = arguments[3];
  74. }
  75. var typeList = new typeList();
  76.